<div class="col-lg-12" id="container-button-save">
    <div id="main_button" class="btn btn-danger">Lưu Dữ Liệu</div>
    <h1 class="page-header">Sản phẩm</h1>
</div>
<?php
$form = $this->beginWidget(
                'booster.widgets.TbActiveForm', array(
            'htmlOptions' => array('class' => '', 'enctype' => 'multipart/form-data', 'id' => 'h_main_form'),
                )
);
?>
<div>
    <input type="submit" name="create_product" value="Lưu và tiếp tục tạo mới >> " class="btn btn-danger"/>
</div>
<br/>
<div class="col-lg-12 well">

    <ul id="myTab" class="nav nav-tabs" role="tablist">
        <li class="active"><a href="#home" role="tab" data-toggle="tab">Thông tin chung</a></li>
        <li class=""><a href="#link" role="tab" data-toggle="tab">Liên kết</a></li>
        <li class=""><a href="#profile" role="tab" data-toggle="tab">Thuộc tính</a></li>
        <li class=""><a href="#seo" role="tab" data-toggle="tab">SEO</a></li>
    </ul>
    <div id="myTabContent" class="tab-content">
        <div class="tab-pane fade active in" id="home">
            <div>
                <br/>
                <?php
                
                echo $form->textFieldGroup($model, 'name');
                echo $form->textFieldGroup($model, 'code');
                echo $form->textFieldGroup($model, 'price');
                echo $form->textFieldGroup($model, 'special');
                echo $form->textFieldGroup($model, 'quantity');
                echo $form->textFieldGroup($model, 'order');
                echo $form->fileFieldGroup($model, 'image');
                ?>
                <?php
                if ($model->getImage() !== false) {
                    echo "<img src='" . urlImageFolder('product') . $model->getImage() . "' height='100' />";
                }
                ?>
                <br/>
                <br/>
                <div id="container_editor">
                    <div id="content_editor">

                    </div>
                    <div id="cover_editor"></div>
                </div>
                <!--<div id="show_editor" class="btn btn-success">Viết Mô Tả</div>-->
            </div>
        </div>
        <div class="tab-pane fade" id="link">
            <p>
                <?php
                echo $form->dropDownListGroup(
                        $model, 'category_id', array(
                            'widgetOptions' => array(
                                'data' => Category::getListCategoryWithoutRoot(1),
                            )
                        )
                );
                echo $form->checkboxListGroup($model, 'categories', array(
                        'widgetOptions' => array(
                            'data' => Category::getListCategoryWithoutRoot(1)
                        ),
                        'label' => 'Danh sách danh mục',
                    ));
                ?>
            </p>
        </div>
        <div class="tab-pane fade" id="profile">
            <p>
                <?php foreach ($productType->propertys(array('condition' => 'status=1')) as $ietm): ?>
                <div class="container_checkbox">
                    <?php
                    echo $form->checkboxListGroup($model, 'valueProperties[' . $ietm->property_id . ']', array(
                        'widgetOptions' => array(
                            'data' => CHtml::listData($ietm->propertyValues((array('condition' => 'status=1'))), 'property_value_id', 'name')
                        ),
                        'label' => $ietm->name,
                    ));
                    ?>
                    <div class="clearfix"></div>
                </div>

            <?php endforeach; ?>
            </p>
        </div>
        <div class="tab-pane fade" id="seo">
            <p>
                <?php
                echo $form->textFieldGroup($model, 'seo_title');
                echo $form->textFieldGroup($model, 'seo_keywork');
                echo $form->textFieldGroup($model, 'seo_description');
                ?>
            </p>
        </div>
    </div>
    <?php
    $this->widget('ext.tinymce.TinyMce', array(
        'model' => $model,
        'attribute' => 'description',
        'fileManager' => array(
            'class' => 'ext.elFinder.TinyMceElFinder',
            'connectorRoute' => 'filemanager/connector',
        ),
        'htmlOptions' => array(
            
        )
    ));
    ?>


</div>

<?php
$this->endWidget();
unset($form);
?>
<div class="col-lg-12 well pull-right">
    <ul id="myTab" class="nav nav-tabs" role="tablist">
        <li class="active"><a href="#conatiner_image" role="tab" data-toggle="tab">Hình ảnh</a></li>

    </ul>
    <div id="myTabContent" class="tab-content">
        <div class="tab-pane fade active in" id="conatiner_image">
            <p>
                <?php
                if (isset($model->product_id) && $model->product_id != null)
                    $this->widget('ImageWidget', array('product_id' => $model->product_id));
                else
                    echo "<div class='alert'>Bạn phải lưu sản phẩm trước khi upload nhiều hình ảnh</div>";
                ?>   
            </p>
        </div>


    </div>
</div>
<div class="col-lg-12 well">

</div>


